<?php

use yii\db\Migration;

/**
 * Handles the creation of table `project_investigation_stakeholder`.
 */
class m171030_064612_create_project_investigation_stakeholder_table extends Migration
{
    /**
     * @inheritdoc
     * 项目尽调报告-干系人及资产情况
     */
    public function up()
    {
        $this->createTable('project_investigation_stakeholder', [
            'id' => $this->bigPrimaryKey(),
            'project_id' => $this->bigInteger()->notNull(),
            'stakeholder_type' => $this->smallInteger()->notNull()->comment('干系人类型'),//1债务人、2抵押人、3保证人、4其他承债人
            'stakeholder_title' => $this->string()->comment('干系人名称'),
            'registered_capital' => $this->string()->comment('注册资本'),
            'registered_address' => $this->string()->comment('注册地址'),
            'legal_representative' => $this->string()->comment('法定代表人'),
            'scope_of_business' => $this->text()->comment('经营范围'),
            'proportion' => $this->text()->comment('股东及持股人比例'),
            'borrower' => $this->text()->comment('借款人状况'),
            'buy_back' => $this->text()->comment('和解回购意愿'),
            //列失信
            'faith' => $this->smallInteger()->comment('是否列失信'),//1是2否
            'limit_high' => $this->smallInteger()->comment('是否限制高消费'),
            'block_list' => $this->string()->comment('失信名单'),
            'block_value' => $this->text()->comment('列失信价值描述'),
            //承债详情
            'guarantee_scope' => $this->text()->comment('抵押担保范围、保证人保证范围、承债理由及法律依据'),
            'guarantee' => $this->text()->comment('抵押物、承债资产情况'),
            'mortgage_order' => $this->text()->comment('抵押顺序'),
            'seal_order' => $this->text()->comment('查封顺序'),
            'other_mortgage' => $this->text()->comment('其他抵押、查封详情'),
            'evaluate_price' => $this->string()->comment('评估价'),
            'auction_price' => $this->string()->comment('拍卖价'),
            'market_price' => $this->string()->comment('市场询价'),
            //现场状态
            'rent' => $this->text()->comment('租赁情况'),
            'live' => $this->text()->comment('居住情况'),
            'interview' => $this->text()->comment('现场访谈其他情况'),
            //回现评估
            'payment_reservation' => $this->string()->comment('回现保守'),
            'reservation_evidence' => $this->text()->comment('保守依据'),
            'payment_radical' => $this->string()->comment('回现激进'),
            'radical_evidence' => $this->text()->comment('激进依据'),
            'created_at' => $this->timestamp(),
            'updated_at' => $this->timestamp(),
            //
            'lock_user' => $this->integer()->comment('上锁用户'),
            'lock_timestamp' => $this->string()->comment('上锁时间'),
        ]);
    }

    /**
     * @inheritdoc
     */
    public function down()
    {
        $this->dropTable('project_investigation_stakeholder');
    }
}
